import 'package:flutter_base_kit/utils/date_format_utils.dart';
import 'package:flutter_base_kit/utils/encrypt_utils.dart';
import 'package:flutter_test/flutter_test.dart';

///test/date_test.dart
void main() {
  testWidgets('测试日期工具类', (WidgetTester tester) async {

    String currentTime = DateFormatUtils.getCurrentTime();
    print("当前时间 $currentTime");

    //格式化时间
    String currentTimeFr = DateFormatUtils.dateTimeToString(
      dateTime: DateTime.now(),
    );
    print("当前时间 $currentTimeFr");

    //解析时间
    String strTime = "2022-03-03 00:36:25";
    DateTime datetime = DateFormatUtils.stringToDate(strTime: strTime);
    //再将datetime转为其他格式
    String otherTime = DateFormatUtils.dateTimeToString(
      dateTime: datetime,
      format: "yyyy年MM月dd日",
    );
    print("其他时间格式 $otherTime");
  });
}
